package cn.web.management.web.servlet.inform.user;

import cn.web.management.service.impl.QuerySalaryImpl;
import cn.web.management.service.inface.QuerySalary;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "payrollDetailServlet", value = "/payrollDetailServlet")
public class payrollDetailServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setContentType("application/json;charset=UTF-8;");
        String payroll = req.getParameter("payroll");
        QuerySalary querySalary = new QuerySalaryImpl();
        String payrollDetail = querySalary.findPayrollDetail(payroll);
        resp.getWriter().write(payrollDetail);
    }
}
